/**
 * Copyright(c) 2010 Ceno Techonologies Co., Ltd.
 *
 * History:
 *   15-6-3 下午2:39 Created by lyyang
 */
package com.jade.bss.weixin.api.protocol.xml.adapter;

import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * 时间适配器
 *
 * @author <a href="mailto:lyyang@ceno.cn">lyyang</a>
 * @version 1.0 15-6-3 下午2:39
 */
public class SecondToDateAdapter
        extends XmlAdapter<Long,Date>
{
    @Override
    public Date unmarshal(Long v)
            throws Exception
    {
        return new Date(v*1000);
    }

    @Override
    public Long marshal(Date v)
            throws Exception
    {
        return v.getTime()/1000;
    }
}
